DomainObjects Class Library |
|
Query<ClassToFind>.AddPrefetch Method
Specifies how deep in the object graph this query will retrieve objects related to the target class. Multiple prefetches may be added to a single query.
By retrieving all objects specified by relatedClassToPrefetch via a single SELECT statement to the database, prefetching avoids lazy loads of related objects and thus improves performance.
Parameters
- relatedClassToPrefetch
- A class in the reference path of the target object. All intermediate objects between the target object and the given relatedClassToPrefetch will be loaded by DomainObjects via a single SELECT statement to the database. The argument that you pass to this method will typically be from your GeneratedQueryFields.cs file.
Example
For code examples, see the Prefetch unit tests.
See Also
Query<ClassToFind> Class | DomainObjects.Facade.Command Namespace